#include<bits/stdc++.h>
#define int long long
using namespace std;

int n;
bool vis[100005],die[100005];
int r[100005],a[100005],b[100005];
int kind=0;

bool check()
{
    for(int i=1;i<=n;i++)
    {
        if(vis[i]==0&&die[i]==0)
        {
            return 0;
        }
    }
    return 1;
}

signed main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
         int ri;
         cin>>ri;
         r[i]=ri;
         a[ri]++;
    }
    for(int i=1;i<=100000;i++)
    {
        if(a[i]!=0)
        {
            b[++kind]=b[kind-1]+a[i];
        }
    }
    if(kind==2)
    {
        if(b[2]-b[1]<b[1])
        {
            cout<<b[1]-b[2]+b[2];
        }
        else
        {
            cout<<b[2];
        }
        return 0;
    }
    else
    {
        sort(r+1,r+n+1);
        int k=n;
        int pos=1;
        while(!check())
        {
            for(int i=pos+1;i<=n;i++)
            {
                if(vis[i]==1) continue;
                vis[i]=1;
                if(r[i]>r[pos])
                {
                    die[pos]=1;
                    pos++;
                    break;
                }
            }
        }
        cout<<n-pos+1;
        return 0;
    }

    fclose(stdin);
    fclose(stdout);
    return 0;
}
